import { request } from '@/api/REQ'
import {auxiliary} from "@/api/request";


const modulePrefix = '/solution'

/* 查看方案 */
export function get(projectId: number, parameter: object) {
	return request({
		url: modulePrefix + `/${projectId}`,
		method: 'get',
		params: parameter,
	})
}


// 复制方案
export function copy(solution_id: number) {
	return request({
		url: modulePrefix + `/copy/${solution_id}`,
		method: 'post',
	})
}

/* 增加方案 */
export function add(data: object) {
	return request({
		url: modulePrefix,
		method: 'post',
		data: data,
	})
}
/* 更新方案 */
export function update(data: object) {
	return request({
		url: modulePrefix + `/update`,
		method: 'post',
		data: data,
	})
}
/* 删除方案 */
export function del(solutionId: number) {
	return request({
		url: modulePrefix + `/${solutionId}`,
		method: 'delete',
	})
}
/* 方案评估 */
export function eva(solutionId: number, project_type: number) {
	return request({
		url: modulePrefix + `/evaluate/${solutionId}&${project_type}`,
		method: 'get',
	})
}

/* 敏感性分析 */
export function analyse(solutionId: number, data: any, project_type: number) {
	return request({
		url: modulePrefix + `/analyze/${solutionId}&${project_type}`,
		method: 'post',
		data: data,
	})
}
/* 获取表格标题 */
export function tables(solutionId: number) {
	return request({
		url: modulePrefix + `/evaluate/${solutionId}`,
		method: 'get',
	})
}

export function report(solutionId: number, projectId: number){
	return request({
		url: modulePrefix + `/report/${solutionId}/${projectId}`,
		method: 'get',
	})
}

export default {
	get,
	add,
	update,
	del,
	eva,
	copy,
	analyse,
	report
}
